<%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2021/1/21
  Time: 15:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
  </head>
  <body>
  <h2 style="color: red;">${msg}</h2>
  <%
    String name="";
    Cookie []cr=request.getCookies();
    //
    if(cr!=null){
      for(Cookie c:cr){
          if(c.getName().equals("user-name"))
              name=c.getValue();
              break;
      }
    }
  %>
  <%
      if(session.getAttribute("LOGIN_USER")==null){
  %>
  <form action="doLogin.jsp" method="post">
    <input type="text" name="userName" value="<%=name%>" placeholder="用户名" required/>
    <input type="password" name="userPass" placeholder="密码" required/>
    <input type="submit" name="b1" value="登录" placeholder="用户名"/>
  </form>
  <%}else{%>
      <h1>您已经登录成功了，<a href="welcome.jsp">去首页</a> </h1>
  <%}%>
  </body>
</html>
